<extend name="./ljfbase" />
<block name="main">
<script src="__PUBLIC__/js/jquery.min.js"></script>
<div class="container mt50 md200">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <ul class="nav nav-tabs">
              <li role="presentation" class="active"><a href="{:U('index')}">好友首页</a></li>
              <li role="presentation"><a href="{:U('search')}">寻找好友</a></li>
              <li role="presentation"><a href="{:U('request')}">好友请求</a></li>
            </ul>
            <div class="row mt30">
                <div class="col-md-9"><strong class="ml10">好友列表</strong></div>
                <div class="col-md-3"><strong>管理</strong></div>
            </div>
            <table class="table table-hover mt10" id="friendlist">
                <volist name="friendslist" id="vo">
                <tr class="frienditem">
                    <td class="col-md-9">
                        <a href="{:U('Home/Index/index',array('user_id'=>$vo['fuser']['id']))}">
                            <img src="__PUBLIC__{$vo.fuser.zonedp}" width="60" height="60" class="mr20">{$vo.fuser.nickname}
                        </a>
                    </td>
                    <td class="col-md-3"><br><a href="javascript:void(0)" fid="{$vo.fuser.id}" dataid="{$vo.id}" class="friend-del">删除好友</a></td>
                </tr>
                </volist>
            </table>
        </div>
    </div>
</div>
<script>
    $('#friendlist').on('click','.friend-del',function(){
        // debugger;
        var self = $(this);
        var id = self.attr('dataid');
        var fid = self.attr('fid');
        $.ajax({
            type: 'POST',
            url: '{:U("Home/Friends/del")}',
            data: {'id':id,'fid':fid},
            dataType: "json",
            success: function(rs){
                if(rs.status == 'success'){
                    self.parents('tr.frienditem').remove();
                }else{
                    alert(rs.msg);
                }
            }
        });
    });
</script>
    
</block>